import React from 'react';
import TabRouter from './TabRouter/TabRouter';
import NavigationContainer from '@react-navigation/native/src/NavigationContainer';
import {createStackNavigator} from '@react-navigation/stack';
import LoginPage from '../pages/LoginPage/LoginPage';
import ActivityIndicatorPage from '../pages/ComponentsPage/ActivityIndicatorPage/ActivityIndicatorPage';
import ButtonPage from '../pages/ComponentsPage/ButtonPage/ButtonPage';
import FlatListPage from '../pages/ComponentsPage/FlatListPage/FlatListPage';
import ImagePage from '../pages/ComponentsPage/ImagePage/ImagePage';
import ImageBackgroundPage from '../pages/ComponentsPage/ImageBackgroundPage/ImageBackgroundPage';
import KeyboardAvoidingViewPage from '../pages/ComponentsPage/KeyboardAvoidingViewPage/KeyboardAvoidingViewPage';
import ModalPage from '../pages/ComponentsPage/ModalPage/ModalPage';
import PressablePage from '../pages/ComponentsPage/PressablePage/PressablePage';
import RefreshControlPage from '../pages/ComponentsPage/RefreshControlPage/RefreshControlPage';
import SafeAreaViewPage from '../pages/ComponentsPage/SafeAreaViewPage/SafeAreaViewPage';
import ScrollViewPage from '../pages/ComponentsPage/ScrollViewPage/ScrollViewPage';
import SectionListPage from '../pages/ComponentsPage/SectionListPage/SectionListPage';
import StatusBarPage from '../pages/ComponentsPage/StatusBarPage/StatusBarPage';
import SwitchPage from '../pages/ComponentsPage/SwitchPage/SwitchPage';
import TextPage from '../pages/ComponentsPage/TextPage/TextPage';
import TextInputPage from '../pages/ComponentsPage/TextInputPage/TextInputPage';
import TouchableHighlightPage from '../pages/ComponentsPage/TouchableHighlightPage/TouchableHighlightPage';
import TouchableOpacityPage from '../pages/ComponentsPage/TouchableOpacityPage/TouchableOpacityPage';
import VirtualizedListPage from '../pages/ComponentsPage/VirtualizedListPage/VirtualizedListPage';
import HttpPage from '../pages/ApiPage/HttpPage/HttpPage';
import { navigationRef } from './RootNavigation';
const Stack = createStackNavigator();
const Router = () => {
	let life = true;
	let authod = life ? (
		<>
			<Stack.Screen component={TabRouter}
    name="tab"
    options={{
					headerShown: false
				}}
			/>
			<Stack.Screen component={LoginPage}
    name="login"
    options={{
				title: '登陆'
			}}
			/>
		</>
	) : (
		<>
			<Stack.Screen component={LoginPage}
    name="login"
    options={{
				title: '登陆'
			}}
			/>
			<Stack.Screen component={TabRouter}
    name="tab"
    options={{
					headerShown: false
				}}
			/>
		</>
	);
	return (
		<NavigationContainer
    ref={navigationRef}
		>
			<Stack.Navigator>
				{authod}
				{/*功能*/}
				<Stack.Screen component={ActivityIndicatorPage}
    name="ActivityIndicator"
    options={{
					title: 'ActivityIndicator'
				}}
				/>
				<Stack.Screen component={ButtonPage}
    name="buttonPage"
    options={{
					title: 'button按钮'
				}}
				/>
				<Stack.Screen component={FlatListPage}
    name="FlatListPage"
    options={{
					title: 'FlatList列表'
				}}
				/>
				<Stack.Screen component={ImagePage}
    name="ImagePage"
    options={{
					title: 'image图片'
				}}
				/>
				<Stack.Screen component={ImageBackgroundPage}
    name="ImageBackgroundPage"
    options={{
					title: 'ImageBackground图片背景'
				}}
				/>
				<Stack.Screen component={KeyboardAvoidingViewPage}
    name="KeyboardAvoidingViewPage"
    options={{
					title: 'KeyboardAvoidingView键盘弹出页面顶起组件'
				}}
				/>
				<Stack.Screen component={ModalPage}
    name="ModalPage"
    options={{
					title: 'Modal弹窗'
				}}
				/>
				<Stack.Screen component={PressablePage}
    name="PressablePage"
    options={{
					title: 'Pressable点击事件过程监测组件'
				}}
				/>
				<Stack.Screen component={RefreshControlPage}
    name="RefreshControlPage"
    options={{
					title: 'RefreshControl下拉刷新组件'
				}}
				/>
				<Stack.Screen component={SafeAreaViewPage}
    name="SafeAreaViewPage"
    options={{
					title: 'SafeAreaView安全区域'
				}}
				/>
				<Stack.Screen component={ScrollViewPage}
    name="ScrollViewPage"
    options={{
					title: 'ScrollView滚动组件'
				}}
				/>
				<Stack.Screen component={SectionListPage}
    name="SectionListPage"
    options={{
					title: 'SectionList列表容器'
				}}
				/>
				<Stack.Screen component={StatusBarPage}
    name="StatusBarPage"
    options={{
					title: 'StatusBar状态栏组件'
				}}
				/>
				<Stack.Screen component={SwitchPage}
    name="SwitchPage"
    options={{
					title: 'Switch切换'
				}}
				/>
				<Stack.Screen component={TextPage}
    name="TextPage"
    options={{
					title: 'Text文本'
				}}
				/>
				<Stack.Screen component={TextInputPage}
    name="TextInputPage"
    options={{
					title: 'TextInput输入框'
				}}
				/>
				<Stack.Screen component={TouchableHighlightPage}
    name="TouchableHighlightPage"
    options={{
					title: 'TouchableHighlight点击变暗'
				}}
				/>
				<Stack.Screen component={TouchableOpacityPage}
    name="TouchableOpacityPage"
    options={{
					title: 'TouchableOpacity点击变淡'
				}}
				/>
				<Stack.Screen component={VirtualizedListPage}
    name="VirtualizedListPage"
    options={{
					title: 'VirtualizedList虚拟滚动底层'
				}}
				/>

				{/*    api */}
				<Stack.Screen component={HttpPage}
    name="HttpPage"
    options={{
					title: 'http请求'
				}}
				/>
			</Stack.Navigator>
		</NavigationContainer>
	);
};
export default Router;
